class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: G = None
        self.z: E = None
        self.o: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: F = None
        self.z: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: C = None
        self.o: C = None
        self.v: D = None
        self.x: B = None
        self.p: B = None
        self.u: H = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: E = None
        self.s: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: F = None
        self.z: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: C = None
        self.o: C = None
        self.v: D = None
        self.x: B = None
        self.p: B = None
        self.u: H = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: E = None
        self.s: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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