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

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

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

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

c = A("c")
j = B("j")
b = C("b")
l = D("l")
g = B("g")
e = A("e")

c.p = l
c.z = b
c.x = b
c.y = e
j.r = c
j.y = l
b.t = l
b.y = j
b.x = e
l.t = c
l.s = c
l.p = j
g.r = c
g.y = l
e.p = l
e.z = b
e.x = b
e.y = c
assert j.y.t.p.p.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.x: C = None
        self.y: A = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
b = C("b")
l = D("l")
g = B("g")
e = A("e")

c.p = l
c.z = b
c.x = b
c.y = e
j.r = c
j.y = l
b.t = l
b.y = j
b.x = e
l.t = c
l.s = c
l.p = j
g.r = c
g.y = l
e.p = l
e.z = b
e.x = b
e.y = c
assert j.y.t.p.p.y.s.txt == "c"