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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: F = None
        self.w: B = None
        self.x: F = None
        self.v: D = None
        self.r: D = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
a = C("a")
g = D("g")
k = E("k")
e = F("e")
h = D("h")
m = E("m")
c = C("c")

f.q = g
f.z = g
l.p = c
l.z = f
a.y = g
a.r = g
a.s = e
a.x = e
a.w = l
a.v = h
g.q = e
g.x = h
k.z = e
k.u = f
e.r = h
h.q = e
h.x = g
m.z = e
m.u = f
c.y = g
c.v = g
c.r = g
c.s = e
c.x = e
c.w = l
assert e.r.q.r.q.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: F = None
        self.w: B = None
        self.x: F = None
        self.v: D = None
        self.r: D = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
a = C("a")
g = D("g")
k = E("k")
e = F("e")
h = D("h")
m = E("m")
c = C("c")

f.q = g
f.z = g
l.p = c
l.z = f
a.y = g
a.r = g
a.s = e
a.x = e
a.w = l
a.v = h
g.q = e
g.x = h
k.z = e
k.u = f
e.r = h
h.q = e
h.x = g
m.z = e
m.u = f
c.y = g
c.v = g
c.r = g
c.s = e
c.x = e
c.w = l
assert e.r.q.r.q.r.q.r.txt == "h"