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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

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