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

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

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

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

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

h.v = j
h.w = c
h.x = l
h.u = l
f.t = h
f.u = l
f.v = b
b.q = l
b.v = j
m.u = j
c.u = b
j.q = l
j.v = b
l.v = j
l.w = m
l.x = h
l.u = h
assert b.q.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.x: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

h.v = j
h.w = c
h.x = l
h.u = l
f.t = h
f.u = l
f.v = b
b.q = l
b.v = j
m.u = j
c.u = b
j.q = l
j.v = b
l.v = j
l.w = m
l.x = h
l.u = h
assert b.q.v.v.v.txt == "j"