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

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

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

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

j = A("j")
d = B("d")
l = C("l")
a = D("a")
m = D("m")
n = C("n")
i = D("i")
k = C("k")
f = A("f")

j.x = f
j.t = l
d.v = j
d.t = j
d.q = a
l.t = f
l.v = f
l.y = a
a.x = j
a.t = i
m.x = j
m.t = a
n.t = j
n.v = j
n.y = a
i.x = f
i.t = m
k.t = j
k.y = i
k.v = f
f.x = j
f.t = l
assert l.v.t.y.x.t.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: C = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
l = C("l")
a = D("a")
m = D("m")
n = C("n")
i = D("i")
k = C("k")
f = A("f")

j.x = f
j.t = l
d.v = j
d.t = j
d.q = a
l.t = f
l.v = f
l.y = a
a.x = j
a.t = i
m.x = j
m.t = a
n.t = j
n.v = j
n.y = a
i.x = f
i.t = m
k.t = j
k.y = i
k.v = f
f.x = j
f.t = l
assert l.v.t.y.x.t.v.x.x.txt == "f"