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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: E = None
        self.r: E = None
        self.z: A = None
        self.o: E = None
        self.t: F = None
        self.txt = txt

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

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

k.p = h
k.r = n
m.w = c
i.p = k
h.z = k
h.q = d
h.v = i
h.x = i
d.u = m
d.y = c
d.r = c
d.o = c
d.z = k
d.t = n
n.r = i
c.u = m
c.y = d
c.r = d
c.o = d
c.z = k
c.t = n
assert d.z.r.r.p.p.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: E = None
        self.r: E = None
        self.z: A = None
        self.o: E = None
        self.t: F = None
        self.txt = txt

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

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

k.p = h
k.r = n
m.w = c
i.p = k
h.z = k
h.q = d
h.v = i
h.x = i
d.u = m
d.y = c
d.r = c
d.o = c
d.z = k
d.t = n
n.r = i
c.u = m
c.y = d
c.r = d
c.o = d
c.z = k
c.t = n
assert d.z.r.r.p.p.x.p.txt == "k"