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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

l = A("l")
b = B("b")
c = C("c")
m = D("m")
f = A("f")
a = A("a")
j = A("j")

l.o = c
l.p = m
l.w = m
b.q = c
b.z = j
b.p = f
c.x = b
m.t = c
f.o = c
f.p = m
f.w = m
a.o = c
a.p = m
a.w = m
j.o = c
j.p = m
j.w = m
assert a.o.x.q.x.p.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

l = A("l")
b = B("b")
c = C("c")
m = D("m")
f = A("f")
a = A("a")
j = A("j")

l.o = c
l.p = m
l.w = m
b.q = c
b.z = j
b.p = f
c.x = b
m.t = c
f.o = c
f.p = m
f.w = m
a.o = c
a.p = m
a.w = m
j.o = c
j.p = m
j.w = m
assert a.o.x.q.x.p.w.t.txt == "c"