class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: E = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: C = None
        self.t: D = None
        self.x: E = None
        self.txt = txt

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

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

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

f = A("f")
j = B("j")
k = C("k")
i = D("i")
l = E("l")
b = D("b")
c = D("c")
m = D("m")
h = C("h")
n = C("n")

f.u = n
f.t = n
f.z = l
j.y = l
j.x = l
j.q = n
j.t = i
k.p = l
k.o = f
i.v = f
l.u = c
l.w = f
b.v = f
c.v = f
m.v = f
h.p = l
h.o = f
n.p = l
n.o = f
assert h.p.u.v.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: E = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: C = None
        self.t: D = None
        self.x: E = None
        self.txt = txt

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

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

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

f = A("f")
j = B("j")
k = C("k")
i = D("i")
l = E("l")
b = D("b")
c = D("c")
m = D("m")
h = C("h")
n = C("n")

f.u = n
f.t = n
f.z = l
j.y = l
j.x = l
j.q = n
j.t = i
k.p = l
k.o = f
i.v = f
l.u = c
l.w = f
b.v = f
c.v = f
m.v = f
h.p = l
h.o = f
n.p = l
n.o = f
assert h.p.u.v.t.p.txt == "l"