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

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

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

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

k = A("k")
c = B("c")
n = C("n")
j = D("j")
e = B("e")
m = D("m")
h = C("h")

k.t = n
c.x = e
n.o = k
n.s = h
n.w = m
n.p = j
j.r = k
e.x = c
m.r = k
h.o = k
h.s = n
h.w = m
h.p = j
assert c.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
n = C("n")
j = D("j")
e = B("e")
m = D("m")
h = C("h")

k.t = n
c.x = e
n.o = k
n.s = h
n.w = m
n.p = j
j.r = k
e.x = c
m.r = k
h.o = k
h.s = n
h.w = m
h.p = j
assert c.x.x.x.x.txt == "c"