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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: D = None
        self.u: G = None
        self.s: D = None
        self.r: F = None
        self.w: D = None
        self.x: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: D = None
        self.x: C = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

f = A("f")
b = B("b")
m = C("m")
h = D("h")
c = E("c")
e = F("e")
l = G("l")
n = F("n")

f.q = c
f.w = h
f.p = m
b.w = e
b.v = c
b.z = f
m.z = c
m.y = h
m.s = h
m.w = h
m.u = l
m.x = l
m.r = n
h.v = l
h.p = f
c.p = n
c.t = h
c.v = h
c.x = m
e.r = c
l.v = b
l.u = b
n.r = c
assert e.r.x.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: D = None
        self.u: G = None
        self.s: D = None
        self.r: F = None
        self.w: D = None
        self.x: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: D = None
        self.x: C = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

f = A("f")
b = B("b")
m = C("m")
h = D("h")
c = E("c")
e = F("e")
l = G("l")
n = F("n")

f.q = c
f.w = h
f.p = m
b.w = e
b.v = c
b.z = f
m.z = c
m.y = h
m.s = h
m.w = h
m.u = l
m.x = l
m.r = n
h.v = l
h.p = f
c.p = n
c.t = h
c.v = h
c.x = m
e.r = c
l.v = b
l.u = b
n.r = c
assert e.r.x.r.r.txt == "c"