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

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

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

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

d = A("d")
f = B("f")
c = C("c")
e = D("e")
l = A("l")
m = B("m")

d.o = c
d.u = e
f.x = c
f.v = e
f.u = l
c.u = l
c.x = e
c.t = e
c.p = m
e.q = d
l.o = c
l.u = e
m.x = c
m.v = e
m.u = d
assert e.q.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.txt = txt

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

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

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

d = A("d")
f = B("f")
c = C("c")
e = D("e")
l = A("l")
m = B("m")

d.o = c
d.u = e
f.x = c
f.v = e
f.u = l
c.u = l
c.x = e
c.t = e
c.p = m
e.q = d
l.o = c
l.u = e
m.x = c
m.v = e
m.u = d
assert e.q.u.q.u.txt == "e"