class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: B = None
        self.s: G = None
        self.o: E = None
        self.p: F = None
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: C = None
        self.p: A = None
        self.v: G = None
        self.w: E = None
        self.y: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: C = None
        self.r: B = None
        self.t: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: C = None
        self.p: A = None
        self.v: G = None
        self.w: E = None
        self.y: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: C = None
        self.r: B = None
        self.t: E = None
        self.z: D = None
        self.txt = txt

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

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