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

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.v: E = None
        self.z: D = None
        self.s: C = None
        self.x: A = None
        self.t: F = None
        self.txt = txt

f = A("f")
i = B("i")
m = C("m")
a = D("a")
k = E("k")
j = F("j")
c = G("c")
d = A("d")
h = D("h")

f.u = j
f.o = h
f.r = i
i.q = d
i.p = c
m.o = c
m.x = f
a.s = i
k.t = m
k.x = c
j.w = i
c.u = a
c.z = a
c.q = d
c.x = d
c.v = k
c.s = m
c.t = j
d.u = j
d.o = a
d.r = i
h.s = i
assert d.o.s.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: D = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.v: E = None
        self.z: D = None
        self.s: C = None
        self.x: A = None
        self.t: F = None
        self.txt = txt

f = A("f")
i = B("i")
m = C("m")
a = D("a")
k = E("k")
j = F("j")
c = G("c")
d = A("d")
h = D("h")

f.u = j
f.o = h
f.r = i
i.q = d
i.p = c
m.o = c
m.x = f
a.s = i
k.t = m
k.x = c
j.w = i
c.u = a
c.z = a
c.q = d
c.x = d
c.v = k
c.s = m
c.t = j
d.u = j
d.o = a
d.r = i
h.s = i
assert d.o.s.p.v.txt == "k"