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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: C = None
        self.q: B = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: C = None
        self.q: B = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: C = None
        self.txt = txt

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

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