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

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

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

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

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

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

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

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

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

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

b.t = h
b.v = i
b.u = k
b.r = k
g.w = b
g.x = c
j.q = m
e.v = k
i.w = b
i.x = e
k.q = b
c.v = j
h.q = m
m.t = j
m.v = g
m.u = k
m.r = k
assert c.v.q.v.w.txt == "b"