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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

h.r = c
h.u = f
e.s = a
d.u = j
b.v = d
b.q = a
b.t = j
b.y = c
b.r = e
j.y = h
j.x = e
j.p = e
g.r = c
g.u = h
a.u = j
c.v = d
c.q = d
c.t = j
c.y = b
c.r = e
f.r = b
f.u = g
assert e.s.u.y.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

h.r = c
h.u = f
e.s = a
d.u = j
b.v = d
b.q = a
b.t = j
b.y = c
b.r = e
j.y = h
j.x = e
j.p = e
g.r = c
g.u = h
a.u = j
c.v = d
c.q = d
c.t = j
c.y = b
c.r = e
f.r = b
f.u = g
assert e.s.u.y.u.u.u.txt == "h"