class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: D = None
        self.r: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.v: B = None
        self.o: B = None
        self.txt = txt

c = A("c")
h = B("h")
g = C("g")
a = D("a")
m = D("m")
d = A("d")

c.s = d
c.r = d
c.u = m
h.r = m
h.s = d
g.r = h
g.w = c
a.q = m
a.y = d
a.v = h
a.o = h
m.q = a
m.y = d
m.v = h
m.o = h
d.s = c
d.r = c
d.u = m
assert c.s.s.s.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: D = None
        self.r: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.v: B = None
        self.o: B = None
        self.txt = txt

c = A("c")
h = B("h")
g = C("g")
a = D("a")
m = D("m")
d = A("d")

c.s = d
c.r = d
c.u = m
h.r = m
h.s = d
g.r = h
g.w = c
a.q = m
a.y = d
a.v = h
a.o = h
m.q = a
m.y = d
m.v = h
m.o = h
d.s = c
d.r = c
d.u = m
assert c.s.s.s.u.o.txt == "h"