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

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

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

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

b = A("b")
h = B("h")
l = C("l")
m = D("m")
g = B("g")
k = D("k")
i = A("i")
j = B("j")
c = D("c")

b.x = i
b.v = i
b.t = l
h.q = l
h.z = l
h.r = l
h.x = c
l.q = i
l.t = i
l.w = g
m.r = l
m.x = c
m.s = h
g.q = l
g.z = l
g.r = l
g.x = m
k.r = l
k.x = m
k.s = h
i.x = b
i.v = b
i.t = l
j.q = l
j.z = l
j.r = l
j.x = c
c.r = l
c.x = k
c.s = h
assert j.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: A = None
        self.t: C = None
        self.txt = txt

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

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

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

b = A("b")
h = B("h")
l = C("l")
m = D("m")
g = B("g")
k = D("k")
i = A("i")
j = B("j")
c = D("c")

b.x = i
b.v = i
b.t = l
h.q = l
h.z = l
h.r = l
h.x = c
l.q = i
l.t = i
l.w = g
m.r = l
m.x = c
m.s = h
g.q = l
g.z = l
g.r = l
g.x = m
k.r = l
k.x = m
k.s = h
i.x = b
i.v = b
i.t = l
j.q = l
j.z = l
j.r = l
j.x = c
c.r = l
c.x = k
c.s = h
assert j.z.w.z.txt == "l"