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

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

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

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

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

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

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

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

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

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

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

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

m.t = k
m.s = k
m.q = h
m.u = h
k.y = c
k.u = c
k.x = f
k.q = m
f.u = m
f.r = c
c.t = m
c.x = m
c.u = f
h.y = j
j.y = h
b.t = m
b.x = m
b.u = f
assert f.u.t.x.u.u.y.txt == "j"