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

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

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

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

j = A("j")
l = B("l")
a = C("a")
k = D("k")
d = A("d")
c = B("c")

j.y = a
l.r = c
l.x = c
l.p = k
a.o = k
a.t = d
k.x = a
k.t = j
d.y = a
c.r = l
c.x = l
c.p = k
assert d.y.o.t.y.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
a = C("a")
k = D("k")
d = A("d")
c = B("c")

j.y = a
l.r = c
l.x = c
l.p = k
a.o = k
a.t = d
k.x = a
k.t = j
d.y = a
c.r = l
c.x = l
c.p = k
assert d.y.o.t.y.o.x.txt == "a"