class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: D = None
        self.p: B = None
        self.r: F = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.q: D = None
        self.y: A = None
        self.x: G = None
        self.r: D = None
        self.t: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: D = None
        self.p: B = None
        self.r: F = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.q: D = None
        self.y: A = None
        self.x: G = None
        self.r: D = None
        self.t: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

f.x = g
f.v = l
l.s = k
l.p = g
k.q = l
k.v = i
k.u = m
m.s = c
g.u = k
g.w = m
g.p = l
g.y = l
g.r = c
c.z = f
c.y = f
c.p = l
c.t = l
c.q = m
c.r = m
c.x = i
i.z = k
assert l.p.r.r.s.q.txt == "m"