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

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

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

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

b = A("b")
e = B("e")
i = C("i")
l = D("l")
j = A("j")
g = D("g")
a = A("a")
m = D("m")
n = B("n")

b.v = g
b.t = i
b.x = m
b.r = a
e.t = i
e.v = m
i.p = g
l.y = i
j.v = l
j.x = l
j.t = i
j.r = a
g.y = i
a.v = m
a.t = i
a.x = g
a.r = b
m.y = i
n.t = i
n.v = l
assert a.v.y.p.y.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: C = None
        self.x: D = None
        self.r: A = None
        self.txt = txt

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

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

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

b = A("b")
e = B("e")
i = C("i")
l = D("l")
j = A("j")
g = D("g")
a = A("a")
m = D("m")
n = B("n")

b.v = g
b.t = i
b.x = m
b.r = a
e.t = i
e.v = m
i.p = g
l.y = i
j.v = l
j.x = l
j.t = i
j.r = a
g.y = i
a.v = m
a.t = i
a.x = g
a.r = b
m.y = i
n.t = i
n.v = l
assert a.v.y.p.y.p.y.p.txt == "g"