class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: D = None
        self.txt = txt

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

c = A("c")
k = B("k")
h = C("h")
m = D("m")
g = E("g")
d = F("d")

c.t = h
k.r = h
h.v = m
h.p = d
m.z = g
m.q = d
m.x = d
m.s = d
m.v = h
m.y = h
g.x = k
g.y = m
d.r = k
assert h.p.r.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: D = None
        self.txt = txt

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

c = A("c")
k = B("k")
h = C("h")
m = D("m")
g = E("g")
d = F("d")

c.t = h
k.r = h
h.v = m
h.p = d
m.z = g
m.q = d
m.x = d
m.s = d
m.v = h
m.y = h
g.x = k
g.y = m
d.r = k
assert h.p.r.r.p.txt == "d"