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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

f = A("f")
i = B("i")
g = C("g")
c = C("c")
d = C("d")
b = A("b")
j = B("j")
k = A("k")
h = B("h")

f.p = h
f.v = i
i.p = k
i.y = k
i.t = c
g.z = i
g.y = i
g.u = j
c.z = j
c.u = i
c.y = h
d.z = i
d.u = i
d.y = h
b.p = h
b.v = h
j.p = b
j.y = k
j.t = g
k.p = h
k.v = j
h.p = f
h.y = k
h.t = c
assert k.p.p.p.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

f = A("f")
i = B("i")
g = C("g")
c = C("c")
d = C("d")
b = A("b")
j = B("j")
k = A("k")
h = B("h")

f.p = h
f.v = i
i.p = k
i.y = k
i.t = c
g.z = i
g.y = i
g.u = j
c.z = j
c.u = i
c.y = h
d.z = i
d.u = i
d.y = h
b.p = h
b.v = h
j.p = b
j.y = k
j.t = g
k.p = h
k.v = j
h.p = f
h.y = k
h.t = c
assert k.p.p.p.t.z.txt == "j"