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

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

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

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

c = A("c")
d = B("d")
b = C("b")
l = D("l")
i = B("i")
j = B("j")
f = A("f")

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

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

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

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

c = A("c")
d = B("d")
b = C("b")
l = D("l")
i = B("i")
j = B("j")
f = A("f")

c.z = f
c.o = f
c.p = l
c.y = l
d.t = l
b.u = l
b.s = i
b.q = f
l.z = b
l.y = b
l.o = i
l.t = d
i.t = l
j.t = l
f.z = c
f.o = c
f.p = l
f.y = l
assert d.t.z.q.y.o.t.z.txt == "b"