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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: C = None
        self.y: B = None
        self.u: A = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
m = C("m")
g = D("g")
b = B("b")
l = B("l")
h = A("h")

d.q = h
d.s = m
f.o = g
f.r = m
f.y = b
f.u = d
m.t = b
m.q = d
g.p = l
g.r = d
g.y = m
b.o = g
b.r = m
b.y = f
b.u = h
l.o = g
l.r = m
l.y = b
l.u = d
h.q = d
h.s = m
assert d.s.q.q.q.s.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: C = None
        self.y: B = None
        self.u: A = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
m = C("m")
g = D("g")
b = B("b")
l = B("l")
h = A("h")

d.q = h
d.s = m
f.o = g
f.r = m
f.y = b
f.u = d
m.t = b
m.q = d
g.p = l
g.r = d
g.y = m
b.o = g
b.r = m
b.y = f
b.u = h
l.o = g
l.r = m
l.y = b
l.u = d
h.q = d
h.s = m
assert d.s.q.q.q.s.t.o.txt == "g"