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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.txt = txt

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

l = A("l")
j = B("j")
c = C("c")
d = D("d")
k = D("k")
h = C("h")
f = D("f")
m = A("m")
b = C("b")

l.y = k
l.p = d
l.u = j
j.q = d
c.t = b
c.o = h
d.q = c
d.y = f
d.t = k
d.u = j
k.q = b
k.y = f
k.t = f
k.u = j
h.t = b
h.o = c
f.q = c
f.y = k
f.t = k
f.u = j
m.y = f
m.p = f
m.u = j
b.t = h
b.o = c
assert h.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: D = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.txt = txt

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

l = A("l")
j = B("j")
c = C("c")
d = D("d")
k = D("k")
h = C("h")
f = D("f")
m = A("m")
b = C("b")

l.y = k
l.p = d
l.u = j
j.q = d
c.t = b
c.o = h
d.q = c
d.y = f
d.t = k
d.u = j
k.q = b
k.y = f
k.t = f
k.u = j
h.t = b
h.o = c
f.q = c
f.y = k
f.t = k
f.u = j
m.y = f
m.p = f
m.u = j
b.t = h
b.o = c
assert h.o.t.o.txt == "c"