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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.v: C = None
        self.w: G = None
        self.r: G = None
        self.o: G = None
        self.t: B = None
        self.txt = txt

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

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

l.t = f
d.o = l
d.t = n
a.r = h
f.o = h
f.v = a
f.w = a
b.t = h
b.o = a
b.q = m
b.p = f
b.r = l
n.q = d
n.t = d
n.z = b
n.v = a
n.w = m
n.r = m
n.o = m
m.u = a
m.w = d
h.t = b
h.o = a
h.q = m
h.p = f
h.r = l
assert a.r.p.w.r.p.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.v: C = None
        self.w: G = None
        self.r: G = None
        self.o: G = None
        self.t: B = None
        self.txt = txt

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

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

l.t = f
d.o = l
d.t = n
a.r = h
f.o = h
f.v = a
f.w = a
b.t = h
b.o = a
b.q = m
b.p = f
b.r = l
n.q = d
n.t = d
n.z = b
n.v = a
n.w = m
n.r = m
n.o = m
m.u = a
m.w = d
h.t = b
h.o = a
h.q = m
h.p = f
h.r = l
assert a.r.p.w.r.p.o.t.txt == "b"