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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: 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.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: D = None
        self.txt = txt

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

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

c.r = b
b.p = m
b.t = m
n.p = c
i.p = b
m.u = k
m.t = i
k.x = n
k.r = b
k.o = b
assert i.p.p.u.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: 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.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: D = None
        self.txt = txt

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

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

c.r = b
b.p = m
b.t = m
n.p = c
i.p = b
m.u = k
m.t = i
k.x = n
k.r = b
k.o = b
assert i.p.p.u.x.p.txt == "c"