class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: C = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.o: D = None
        self.txt = txt

i = A("i")
m = B("m")
c = C("c")
k = D("k")
h = C("h")
f = D("f")
j = B("j")
b = B("b")

i.x = k
i.p = h
i.r = h
i.t = j
m.x = k
c.r = k
k.y = h
k.q = i
k.o = f
h.r = f
f.y = h
f.q = i
f.o = k
j.x = k
b.x = k
assert i.x.o.y.r.o.y.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: C = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.o: D = None
        self.txt = txt

i = A("i")
m = B("m")
c = C("c")
k = D("k")
h = C("h")
f = D("f")
j = B("j")
b = B("b")

i.x = k
i.p = h
i.r = h
i.t = j
m.x = k
c.r = k
k.y = h
k.q = i
k.o = f
h.r = f
f.y = h
f.q = i
f.o = k
j.x = k
b.x = k
assert i.x.o.y.r.o.y.r.o.txt == "k"