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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

e.t = b
e.x = j
e.v = j
e.q = m
j.s = c
b.s = j
b.y = l
m.y = h
m.v = b
d.t = b
d.x = j
d.v = j
d.q = m
l.t = h
l.x = j
l.v = j
l.q = m
c.t = b
c.x = j
c.v = j
c.q = m
h.s = j
h.y = e
assert c.q.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: B = None
        self.q: D = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

e.t = b
e.x = j
e.v = j
e.q = m
j.s = c
b.s = j
b.y = l
m.y = h
m.v = b
d.t = b
d.x = j
d.v = j
d.q = m
l.t = h
l.x = j
l.v = j
l.q = m
c.t = b
c.x = j
c.v = j
c.q = m
h.s = j
h.y = e
assert c.q.v.s.s.txt == "c"