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

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

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

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

j = A("j")
l = B("l")
c = C("c")
h = D("h")
g = C("g")
b = D("b")
e = C("e")

j.w = c
j.q = h
j.s = g
l.p = e
l.x = j
c.x = e
h.w = g
h.v = b
h.o = b
h.u = c
g.x = c
b.w = g
b.v = h
b.o = h
b.u = c
e.x = c
assert b.u.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: D = None
        self.s: C = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
c = C("c")
h = D("h")
g = C("g")
b = D("b")
e = C("e")

j.w = c
j.q = h
j.s = g
l.p = e
l.x = j
c.x = e
h.w = g
h.v = b
h.o = b
h.u = c
g.x = c
b.w = g
b.v = h
b.o = h
b.u = c
e.x = c
assert b.u.x.x.x.txt == "e"