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

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

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

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

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

d.o = h
d.r = h
d.u = e
d.q = m
l.v = b
h.y = g
b.x = h
b.s = l
b.p = l
b.v = l
g.o = h
g.r = h
g.u = e
g.q = m
m.x = h
m.s = e
m.p = l
m.v = l
a.o = h
a.r = h
a.u = l
a.q = m
e.v = m
j.o = h
j.r = h
j.u = e
j.q = b
assert g.u.v.x.y.u.v.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: B = None
        self.q: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

d.o = h
d.r = h
d.u = e
d.q = m
l.v = b
h.y = g
b.x = h
b.s = l
b.p = l
b.v = l
g.o = h
g.r = h
g.u = e
g.q = m
m.x = h
m.s = e
m.p = l
m.v = l
a.o = h
a.r = h
a.u = l
a.q = m
e.v = m
j.o = h
j.r = h
j.u = e
j.q = b
assert g.u.v.x.y.u.v.x.y.txt == "g"