class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: F = None
        self.y: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: G = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: G = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.txt = txt

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

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