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

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

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

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

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

g = A("g")
c = B("c")
m = C("m")
i = D("i")
l = E("l")
k = C("k")
b = E("b")
f = A("f")

g.r = c
g.x = c
g.p = c
g.y = l
g.q = f
c.q = i
c.p = g
m.s = b
m.y = b
m.p = c
m.v = c
i.x = l
i.r = m
l.s = c
k.s = b
k.p = c
k.v = c
k.y = l
b.s = c
f.r = c
f.x = c
f.p = c
f.y = l
f.q = g
assert f.q.p.p.y.s.p.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: E = None
        self.x: B = None
        self.p: B = None
        self.q: A = None
        self.txt = txt

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

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

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

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

g = A("g")
c = B("c")
m = C("m")
i = D("i")
l = E("l")
k = C("k")
b = E("b")
f = A("f")

g.r = c
g.x = c
g.p = c
g.y = l
g.q = f
c.q = i
c.p = g
m.s = b
m.y = b
m.p = c
m.v = c
i.x = l
i.r = m
l.s = c
k.s = b
k.p = c
k.v = c
k.y = l
b.s = c
f.r = c
f.x = c
f.p = c
f.y = l
f.q = g
assert f.q.p.p.y.s.p.x.q.txt == "i"