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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: E = None
        self.t: D = None
        self.s: E = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: D = None
        self.z: B = None
        self.y: E = None
        self.txt = txt

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

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

h = A("h")
g = B("g")
n = C("n")
f = D("f")
a = E("a")
b = D("b")
l = B("l")

h.y = l
g.y = h
g.r = a
g.s = a
g.z = a
g.t = b
n.x = b
n.v = b
n.z = g
n.y = a
f.r = h
f.u = b
a.v = f
b.r = h
b.u = f
l.y = h
l.r = a
l.s = a
l.z = a
l.t = b
assert b.u.u.u.r.y.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: E = None
        self.t: D = None
        self.s: E = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: D = None
        self.z: B = None
        self.y: E = None
        self.txt = txt

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

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

h = A("h")
g = B("g")
n = C("n")
f = D("f")
a = E("a")
b = D("b")
l = B("l")

h.y = l
g.y = h
g.r = a
g.s = a
g.z = a
g.t = b
n.x = b
n.v = b
n.z = g
n.y = a
f.r = h
f.u = b
a.v = f
b.r = h
b.u = f
l.y = h
l.r = a
l.s = a
l.z = a
l.t = b
assert b.u.u.u.r.y.r.v.txt == "f"