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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: C = None
        self.z: C = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: B = None
        self.z: A = None
        self.w: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

f = A("f")
j = B("j")
c = C("c")
n = D("n")
e = E("e")
m = C("m")
g = D("g")

f.t = g
f.o = m
f.v = c
j.v = e
j.o = e
j.u = c
j.z = c
c.x = e
c.s = j
c.z = f
c.w = m
n.x = j
n.s = g
e.o = j
m.x = e
m.s = j
m.z = f
m.w = c
g.x = j
g.s = n
assert f.t.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: C = None
        self.z: C = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: B = None
        self.z: A = None
        self.w: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

f = A("f")
j = B("j")
c = C("c")
n = D("n")
e = E("e")
m = C("m")
g = D("g")

f.t = g
f.o = m
f.v = c
j.v = e
j.o = e
j.u = c
j.z = c
c.x = e
c.s = j
c.z = f
c.w = m
n.x = j
n.s = g
e.o = j
m.x = e
m.s = j
m.z = f
m.w = c
g.x = j
g.s = n
assert f.t.s.s.s.txt == "n"