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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

m = A("m")
c = B("c")
e = C("e")
f = D("f")
h = E("h")
n = F("n")
j = F("j")
b = D("b")
i = C("i")

m.z = j
c.r = h
e.v = f
e.p = c
f.v = h
h.p = b
h.r = i
n.y = c
n.v = c
n.p = c
n.t = e
j.y = c
j.v = c
j.p = c
j.t = i
b.v = h
i.v = f
i.p = c
assert c.r.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

m = A("m")
c = B("c")
e = C("e")
f = D("f")
h = E("h")
n = F("n")
j = F("j")
b = D("b")
i = C("i")

m.z = j
c.r = h
e.v = f
e.p = c
f.v = h
h.p = b
h.r = i
n.y = c
n.v = c
n.p = c
n.t = e
j.y = c
j.v = c
j.p = c
j.t = i
b.v = h
i.v = f
i.p = c
assert c.r.p.v.txt == "h"