class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: F = None
        self.x: B = None
        self.q: C = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: C = None
        self.t: F = None
        self.o: A = None
        self.txt = txt

n = A("n")
m = B("m")
j = C("j")
d = D("d")
h = E("h")
e = F("e")
l = G("l")

n.r = m
n.x = m
n.s = e
n.u = e
n.q = j
m.q = d
j.w = h
d.p = n
d.q = l
d.o = l
h.u = l
e.o = l
e.t = l
e.u = j
e.q = j
e.x = h
l.s = m
l.v = j
l.t = e
l.o = n
assert d.p.x.q.p.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: F = None
        self.x: B = None
        self.q: C = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: C = None
        self.t: F = None
        self.o: A = None
        self.txt = txt

n = A("n")
m = B("m")
j = C("j")
d = D("d")
h = E("h")
e = F("e")
l = G("l")

n.r = m
n.x = m
n.s = e
n.u = e
n.q = j
m.q = d
j.w = h
d.p = n
d.q = l
d.o = l
h.u = l
e.o = l
e.t = l
e.u = j
e.q = j
e.x = h
l.s = m
l.v = j
l.t = e
l.o = n
assert d.p.x.q.p.u.x.txt == "h"