class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

g = A("g")
a = B("a")
c = C("c")
h = D("h")
e = E("e")
j = B("j")
d = C("d")
f = E("f")
m = C("m")
l = D("l")

g.t = j
a.u = l
a.t = g
a.y = e
a.x = j
a.w = j
c.x = g
h.o = m
h.r = m
h.v = g
h.t = g
h.w = l
e.t = g
j.u = h
j.t = g
j.y = f
j.x = a
j.w = a
d.x = g
f.t = g
m.x = g
l.o = m
l.r = m
l.v = g
l.t = g
l.w = h
assert e.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

g = A("g")
a = B("a")
c = C("c")
h = D("h")
e = E("e")
j = B("j")
d = C("d")
f = E("f")
m = C("m")
l = D("l")

g.t = j
a.u = l
a.t = g
a.y = e
a.x = j
a.w = j
c.x = g
h.o = m
h.r = m
h.v = g
h.t = g
h.w = l
e.t = g
j.u = h
j.t = g
j.y = f
j.x = a
j.w = a
d.x = g
f.t = g
m.x = g
l.o = m
l.r = m
l.v = g
l.t = g
l.w = h
assert e.t.t.t.t.txt == "j"