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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.x: B = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.x: B = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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