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

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

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

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

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

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

h.r = e
g.r = c
g.u = f
g.q = n
n.q = g
n.r = g
n.s = g
n.t = l
n.y = e
e.q = f
e.v = c
e.y = g
e.s = n
b.o = f
l.r = e
c.q = h
c.v = e
c.y = g
c.s = n
f.r = e
assert f.r.q.r.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

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

h.r = e
g.r = c
g.u = f
g.q = n
n.q = g
n.r = g
n.s = g
n.t = l
n.y = e
e.q = f
e.v = c
e.y = g
e.s = n
b.o = f
l.r = e
c.q = h
c.v = e
c.y = g
c.s = n
f.r = e
assert f.r.q.r.y.u.txt == "f"