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

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

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

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

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

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

c.t = m
b.o = j
b.x = h
b.q = a
d.y = b
j.t = d
j.p = b
j.s = f
h.t = c
h.u = j
a.t = c
a.u = f
m.o = j
m.x = h
m.q = h
f.t = d
f.p = b
f.s = j
assert m.o.t.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

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

c.t = m
b.o = j
b.x = h
b.q = a
d.y = b
j.t = d
j.p = b
j.s = f
h.t = c
h.u = j
a.t = c
a.u = f
m.o = j
m.x = h
m.q = h
f.t = d
f.p = b
f.s = j
assert m.o.t.y.o.txt == "j"