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

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

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

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

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

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

m = A("m")
d = B("d")
a = C("a")
b = D("b")
e = E("e")
l = F("l")
h = C("h")
c = E("c")
j = A("j")
n = B("n")

m.r = e
d.t = b
a.r = n
a.s = c
a.w = c
a.o = d
b.r = l
b.p = d
b.s = d
e.p = j
l.q = c
l.s = m
l.z = b
l.y = b
l.r = h
h.r = n
h.s = e
h.w = e
h.o = d
c.p = j
j.r = c
n.t = b
assert c.p.r.p.r.p.r.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

m = A("m")
d = B("d")
a = C("a")
b = D("b")
e = E("e")
l = F("l")
h = C("h")
c = E("c")
j = A("j")
n = B("n")

m.r = e
d.t = b
a.r = n
a.s = c
a.w = c
a.o = d
b.r = l
b.p = d
b.s = d
e.p = j
l.q = c
l.s = m
l.z = b
l.y = b
l.r = h
h.r = n
h.s = e
h.w = e
h.o = d
c.p = j
j.r = c
n.t = b
assert c.p.r.p.r.p.r.p.r.p.txt == "j"