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

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: B = None
        self.x: B = None
        self.txt = txt

j = A("j")
l = B("l")
h = C("h")
d = D("d")
c = A("c")

j.z = h
j.q = h
j.o = l
j.r = l
l.o = c
l.w = d
l.r = d
l.s = h
h.o = l
h.w = l
h.y = d
d.z = l
d.w = l
d.x = l
c.z = h
c.q = h
c.o = l
c.r = l
assert d.z.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: B = None
        self.q: C = None
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: B = None
        self.x: B = None
        self.txt = txt

j = A("j")
l = B("l")
h = C("h")
d = D("d")
c = A("c")

j.z = h
j.q = h
j.o = l
j.r = l
l.o = c
l.w = d
l.r = d
l.s = h
h.o = l
h.w = l
h.y = d
d.z = l
d.w = l
d.x = l
c.z = h
c.q = h
c.o = l
c.r = l
assert d.z.w.x.txt == "l"