class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: E = None
        self.q: F = None
        self.x: F = None
        self.u: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: C = None
        self.p: E = None
        self.v: B = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: G = None
        self.w: B = None
        self.u: D = None
        self.y: F = None
        self.p: H = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: H = None
        self.r: E = None
        self.x: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

d = A("d")
b = B("b")
g = C("g")
f = D("f")
a = E("a")
e = F("e")
l = G("l")
k = H("k")
m = C("m")

d.p = b
d.r = a
d.q = e
d.x = e
d.u = k
b.w = m
b.v = f
b.s = a
g.o = k
g.u = m
g.p = a
g.v = b
g.y = f
f.r = k
a.o = d
a.x = l
a.q = l
a.w = b
a.u = f
a.y = e
a.p = k
e.v = b
e.o = b
e.z = b
e.u = g
e.t = f
e.q = f
e.y = a
l.v = d
l.w = k
l.r = a
l.x = a
k.t = f
m.o = k
m.u = g
m.p = a
m.v = b
m.y = f
assert k.t.r.t.r.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: E = None
        self.q: F = None
        self.x: F = None
        self.u: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: C = None
        self.p: E = None
        self.v: B = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: G = None
        self.w: B = None
        self.u: D = None
        self.y: F = None
        self.p: H = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: H = None
        self.r: E = None
        self.x: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

d = A("d")
b = B("b")
g = C("g")
f = D("f")
a = E("a")
e = F("e")
l = G("l")
k = H("k")
m = C("m")

d.p = b
d.r = a
d.q = e
d.x = e
d.u = k
b.w = m
b.v = f
b.s = a
g.o = k
g.u = m
g.p = a
g.v = b
g.y = f
f.r = k
a.o = d
a.x = l
a.q = l
a.w = b
a.u = f
a.y = e
a.p = k
e.v = b
e.o = b
e.z = b
e.u = g
e.t = f
e.q = f
e.y = a
l.v = d
l.w = k
l.r = a
l.x = a
k.t = f
m.o = k
m.u = g
m.p = a
m.v = b
m.y = f
assert k.t.r.t.r.t.r.t.txt == "f"