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

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

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

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

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

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

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

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

l.o = k
l.r = k
d.t = m
d.x = k
d.y = k
d.r = j
j.z = d
j.p = m
k.p = d
h.u = b
b.u = l
b.x = d
m.p = k
m.u = k
m.w = h
m.x = h
m.s = b
m.z = b
assert j.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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

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

l.o = k
l.r = k
d.t = m
d.x = k
d.y = k
d.r = j
j.z = d
j.p = m
k.p = d
h.u = b
b.u = l
b.x = d
m.p = k
m.u = k
m.w = h
m.x = h
m.s = b
m.z = b
assert j.z.r.z.txt == "d"