class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

c = A("c")
b = B("b")
f = C("f")
e = B("e")
l = B("l")
m = A("m")
h = B("h")
d = B("d")
a = A("a")
j = A("j")

c.v = l
c.s = f
c.p = j
b.v = c
f.v = b
f.u = a
f.p = e
e.v = a
l.v = c
m.v = d
m.s = f
m.p = c
h.v = j
d.v = c
a.v = l
a.s = f
a.p = c
j.v = b
j.s = f
j.p = c
assert f.u.v.v.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

c = A("c")
b = B("b")
f = C("f")
e = B("e")
l = B("l")
m = A("m")
h = B("h")
d = B("d")
a = A("a")
j = A("j")

c.v = l
c.s = f
c.p = j
b.v = c
f.v = b
f.u = a
f.p = e
e.v = a
l.v = c
m.v = d
m.s = f
m.p = c
h.v = j
d.v = c
a.v = l
a.s = f
a.p = c
j.v = b
j.s = f
j.p = c
assert f.u.v.v.s.u.s.txt == "f"