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

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

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

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

l = A("l")
f = B("f")
h = C("h")
c = D("c")
n = D("n")
b = B("b")
j = A("j")

l.v = n
l.t = j
f.y = j
f.x = j
f.o = h
h.y = l
c.y = n
n.y = c
b.y = l
b.x = j
b.o = h
j.v = n
j.t = l
assert l.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: A = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
h = C("h")
c = D("c")
n = D("n")
b = B("b")
j = A("j")

l.v = n
l.t = j
f.y = j
f.x = j
f.o = h
h.y = l
c.y = n
n.y = c
b.y = l
b.x = j
b.o = h
j.v = n
j.t = l
assert l.v.y.y.txt == "n"